<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>注册</title>
        <link rel="stylesheet" href="/public/design/register.css" type="text/css"/>
    </head>
    <body>
        <div id="container">
            <form action="@{B.register}" method="post" id="login">
                <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td colspan="2"><img src="/public/design/img/login/logo_1_copy.png"/></td>
                    </tr>
                    <tr>
                        <td colspan="2" class="title">注册通行证&nbsp;成为橡木侠</td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="text" placeholder="手机号" class="input" name="mobile"/>
                            <input type="button" name="fasong" id="fasong" value="发送验证码" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="text" placeholder="验证码" class="input" name="valcode"/></td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <input type="text" placeholder="用户名" class="input" name="account"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="password" placeholder="密码" class="input eye" name="passwd" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="password" placeholder="确认密码" class="input eye" id="passwd2"/>
                        </td>
                    </tr>

                    <tr>
                        <td class="c"><input type="checkbox"/> &nbsp;我已阅读并接受《用户协议》</td>
                    </tr>
                    <tr>
                        <td colspan="2"><input type="submit" value="注册" class="login"/></td>
                    </tr>
                    <tr>
                        <td colspan="2" class="d"><a href="@{App.login}">已有账号，直接登录</a></td>
                    </tr>
                </table>	
            </form>
        </div>
        <script type="text/javascript" src="/public/design/js/jquery-1.11.3.js" ></script>
        <script type="text/javascript" src="/public/javascripts/jquery.form.min.js" ></script>
        <script type="text/javascript" src="/public/javascripts/xjp.js" ></script>

        <script>
            $(function () {
                $('#login').ajaxForm();
                $("#fasong").click(function () {
                    //执行获取验证码的操作
                    GetNumber();
                    $.post("@{B.validateMobileForNewUser}", {"mobile": $("input[name=mobile]").val()});
                });

                var count = 60;
                function GetNumber() {
                    $("#fasong").attr("disabled", "disabled");
                    $("#fasong").val("重新发送(" + count + ")");
                    count--;
                    if (count > 0) {
                        setTimeout(GetNumber, 1000);
                    } else {
                        $("#fasong").val("点击获取验证码");
                        $("#fasong").attr("disabled", "");
                    }
                }
            });
        </script>
    </body>
</html>
